import java.io.*;

public class readfile {

	public static void main(String[] args) {
		
        String Result_txt='';
		try {
            
			FileReader fr1=new FileReader("..\\file\\num1.txt");
			BufferedReader br1=new BufferedReader(fr1);
			FileReader fr2=new FileReader("..\\file\\num2.txt");
			BufferedReader br2=new BufferedReader(fr2);
			FileReader fr3=new FileReader("..\\file\\op.txt");
			BufferedReader br3=new BufferedReader(fr3);
			String str1= br1.readLine(),str2=br2.readLine(),str3=br3.readLine();

			
			for(int i=0;i<str3.length;i++){
				  Result_txt+=str3[i]+':\n';
				  for(int j=0;j<str2.length;j++){
				    for(int n=0;n<br1.length;n++){
				      if(str3[i]==='+'){
				        Result_txt += str1[n].toString()+str3[i]+str2[j].toString()+'='+(Integer.valueOf(str1[n])+Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='-'){
						Result_txt+=str1[n].toString()+str3[i]+str2[j].toString()+'='+(Integer.valueOf(str1[n])-Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='*'){
						Result_txt+=str1[n].toString()+str3[i]+str2[j].toString()+'='+(Integer.valueOf(str1[n])*Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='/'){
						Result_txt+=str1[n].toString()+str3[i]+str2[j].toString()+'='+(Integer.valueOf(str1[n])/Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='%'){
						Result_txt+=str1[n].toString()+str3[i]+str2[j].toString()+'='+(Integer.valueOf(str1[n])%Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='<<'){
						Result_txt+=str1[n]+str3[i].toString()+str2[j].toString()+'='+(Integer.valueOf(str1[n])<<Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='^'){
				    	 Result_txt+=str1[n]+str3[i].toString()+str2[j].toString()+'='+(Integer.valueOf(str1[n])^Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='<<<'){
						Result_txt+=str1[n]+str3[i].toString()+str2[j].toString()+'='+(Integer.valueOf(str1[n])<<<Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='&'){
						Result_txt+=str1[n]+str3[i].toString()+str2[j].toString()+'='+((Integer.valueOf(str1[n])&Integer.valueOf(str2[j]))+'\t';
				      }else if(str3[i]==='|'){
						Result_txt+=str1[n]+str3[i].toString()+str2[j].toString()+'='+(Integer.valueOf(str1[n])|Integer.valueOf(str2[j]))+'\t';
				      }
				    }
				  }
				  Result_txt+='\n\n';
				  Result_txt.toString();
				}
			System.out.println(Result_txt);
            FileWriter fw=new FileWriter("..\\file\\result.txt");
            BufferedWriter bw=new BufferedWriter(fw);
			bw.write(Result_txt.toString());
			bw.flush();            
			bw.close(); 
			
			br1.close();
			br2.close();
			br3.close();
 
			
		}catch(IOException e) {

			e.printStackTrace();

		}
	}

}
